@REM Test if visual studio vcvarsall.bat is available
if not exist "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" (
    echo "Visual Studio 2022 is not installed. Please install it first."
    exit /b 1
)

@REM Test if the vs environment is already activated
if not defined VSINSTALLDIR (
    call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64
)

mkdir build
cd build

:: Set this path accordingly
pushd "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community"
call VC\Auxiliary\Build\vcvars64.bat
popd

cmake -GNinja ^
      -DCMAKE_PREFIX_PATH=%CONDA_PREFIX% ^
      -DCMAKE_TOOLCHAIN_FILE=%CONDA_PREFIX%\h2o.cmake ^
      -DCMAKE_BUILD_TYPE=Release ^
      -DPHOTO_PROBLEM_3=ON ^
      ../

ninja

"bin/problem3.exe"